package gptma.fo.controler.task;

import gptma.bo.dao.FetchInformation;
import gptma.bo.model.task.Task;
import gptma.bo.services.employee.EmployeeServices;
import gptma.fo.cdi.ViewScoped;
import gptma.fo.controler.LazyResultPage;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import javax.inject.Named;

/**
 * 
 * @author xcl
 */
@Named
@ViewScoped
public class TaskListPage extends LazyResultPage<Task> implements Serializable {

	private static final long serialVersionUID = -5059349175717643372L;

	@EJB
	private EmployeeServices employeeServices;

	@Override
	protected List<Task> fetchResults(int first, int pageSize) {
		return employeeServices.findAssignedTasks(user, new FetchInformation(
				first, pageSize));
	}

	@Override
	protected Long getRowCount() {
		return employeeServices.findAssignedTasksCount(user);
	}

}
